package com.qk.management.controller;

import com.qk.common.PageResult;
import com.qk.common.Result;
import com.qk.management.service.OperateLogService;
import com.qk.vo.operateLog.OperateLogVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 *
 * @author lyl
 * @created 2025/10/17 20:16
 * @description
 *
 */
@Slf4j
@RestController
@RequestMapping("/logs")
@SuppressWarnings("all")
public class OperateLogController {

    @Autowired
    private OperateLogService operateLogService;

    @GetMapping
    public Result getLogs(@RequestParam(required = false) String operateUserName, @RequestParam Integer page, @RequestParam Integer pageSize){
        log.info("查询操作日志,参数:操作人名称={},当前页码={},每页大小={}", operateUserName, page, pageSize);
        PageResult<OperateLogVO> pageResult = operateLogService.getLogs(operateUserName, page, pageSize);
        return Result.success(pageResult);
    }
}
